package com.s666.demo.util;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

@Data
public class JPerson {

    private String name;

    private Integer age;

    @JSONField(format = "yyyy-MM-dd hh:mm:ss")
    private Date date;

    /**
     * 默认是不支持 LocalDateTime 的；
     * 如果需要则定义相关的ObjectDeserializer
     */
    @JSONField(
            serializeUsing = LocalDateTimeSerializer.class,
            deserializeUsing = LocalDateTimeSerializer.class
    )
    private LocalDateTime localDate;
}
